package com.u2b.global.utils;

import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class CheckParameter
{

    public static void checkParameterNumber(int size, PreparedStatement ps) throws SQLException
    {
        ParameterMetaData pma = ps.getParameterMetaData();
        int paramNumber = pma.getParameterCount();//
        if (size != paramNumber)
            throw new SQLException("Map中的参数个数与SQL中要求的参数个数不匹配");
    }

    public static boolean checkThisParamsIsNull(String name)
    {
        if (name == null)
        {
            return false;
        }
        else if (name.trim().equals(""))
        {
            return false;
        }

        return true;
    }

}
